<template>
  <div class="tab">
    <ul class="tab_main flex">
      <li :class="[tabLocation == 1 ? 'tab_li active' : 'tab_li']" @click="toIndex">
        <div>
          <i class="iconfont icontab icon-home2"></i>
        </div>
        <p>首页</p>
      </li>
      <li :class="[tabLocation == 2 ? 'tab_li active' : 'tab_li']" @click="toUser">
        <div>
          <i class="iconfont icontab icon-wode2"></i>
        </div>
        <p>我的</p>
      </li>
    </ul>
  </div>
</template>



<script>
export default {
  name: 'tab',
  data () {
    return {
      tabLocation: 0,
    }
  },
  methods: {
    toIndex(){
      console.log(1);
      this.tabLocation = 1;
      this.$router.push({path:'/'})
      console.log(this.tabLocation);
    },
    toUser(){
      console.log(2);
      this.tabLocation = 2;
      this.$router.push({
        path:'/user',
        // params: {
        //   id: 2
        // }
      })
    },
  }
}
</script>



<style scoped>
  .tab{
    text-align: center;
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    background-color: #fff;
  }
  .tab_main{
    border-top: 1px solid #797979;
    box-sizing: border-box;
    padding: 0.25rem 0 0;
    /*height: 5rem;*/
  }
  .tab_main .active{
    color: #2ECC80;
  }
  .tab_li{
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    flex: 1;
    color: #B5B5B5;
  }
  .tab_li p{
    font-size: 0.9rem;
  }
  .icontab{
    font-size: 1.5rem;
  }
</style>
<style>
  *:focus{
    outline-offset: 0px;
    outline: -webkit-focus-ring-color auto 0px;
  }
  ul,li,li,a,p,span{
    margin: 0;
    padding: 0;
  }
  li{
    list-style: none;
  }
  .flex{
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
  }
</style>